package asteroids.model.programs.parsing.types;

import be.kuleuven.cs.som.annotate.Basic;
import asteroids.Util;

public class DoubleLiteral extends Type{

	public DoubleLiteral(double value){
		this.value = value;
	}

	public DoubleLiteral(){
		this.value=0.0;
	}

	@Basic
	public double getValue(){
		return value;
	}

	private double value;

	@Override
	public String toString(){
		return( "" +getValue());
	}

	@Override
	public boolean equals(Object object){
		if(!(object instanceof DoubleLiteral)){
			return false;
		}
		return (Util.fuzzyEquals(getValue(),((DoubleLiteral) object).getValue()));
	}

	@Override
	public int hashCode(){
		return (int) getValue();
	}
}
